The EventQuery object contains the following methods:
Note: Some of the examples in this topic use the WScript.Sleep statement, which is not recommended for use when scripting in CygNet Studio. Use TheView EventTimer instead.
The CancelEventFiltering method cancels the filtering of events.
CancelEventFiltering()
Example
The following example cleans up the query after it is finished, by canceling the filtering and destroying the filter.
|
Sub
'event query is finished EventQuery.CancelEventFiltering() EventQuery.DestroyEventFilter(100)
End Sub |
The ClearQueryResults method clears the results of a previous query and initializes the processing flags. The queries (filters) themselves are not cleared.
ClearQueryResults()
Clearing the results of a previous query is good programming practice if multiple queries are to be performed.
It is necessary to call ClearQueryResults after creating a filter in order to run to the filter.
Example
The following example addresses clearing the query results before retrieving data from the query.
|
Sub
'query is all set up While bIsFiltering
WScript.Sleep(1000)
'call before retrieving data EventQuery.ClearQueryResults()
'retrieve data, etc. Wend
End Sub |
The CreateEventFilter method creates a new event filter thread.
CreateEventFilter(StartTime As Date, EndTime As Date, UpdateInterval As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
StartTime |
Yes |
The earliest date/time of events to be filtered. Note that this value can either be a string in the machine-chosen date/time format (i.e. 'MM/DD/YY hh:mm:ss'for a machine using the American date/time format), or it can be a Date returned from the CDate function. |
|
EndTime |
Yes |
The latest date/time of events to be filtered. Note that this value can either be a string in the machine-chosen date/time format (i.e. 'MM/DD/YY hh:mm:ss'for a machine using the American date/time format), or it can be a Date returned from the CDate function. |
|
UpdateInterval |
Yes |
The periodic run interval in seconds. |
It is necessary to call ClearQueryResults after creating a filter in order to run to the filter.
Example
The following example goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
|
Sub
'-----------------SETUP------------------ Dim date1, date2 date1 = Date - 10 date2 = Date Dim startDate, endDate startDate = CDate(date1) endDate = CDate(date2)
'create event filter for events between now and 10 days ago Dim bCreatedOk bCreatedOk = EventQuery.CreateEventFilter(startDate, endDate, 5)
'initialize the filter (this step is necessary) EventQuery.ClearQueryResults
'set the service-specific filters from existing XMLs (see the documentation for 'SetAudFilterAsXml/SetElsAlmFilterAsXml/SetElsFilterAsXml for examples of 'XML filters) Dim bSetAud bSetAud = EventQuery.SetAudFilterAsXml(g_xmlAudFilter) EventQuery.SetAudSiteServices("CYGDEMO.AUD;CYGDEMO.AUD1")
Dim bSetElsAlm bSetElsAlm = EventQuery.SetElsAlmFilterAsXml(g_xmlElsAlmFilter) EventQuery.SetElsAlmSiteServices("CYGDEMO.ELSALM;CYGDEMO.ELSALM1")
Dim bSetEls bSetEls = EventQuery.SetElsFilterAsXml(g_xmlElsFilter) EventQuery.SetElsSiteServices("CYGDEMO.ELS;CYGDEMO.ELS1")
'set notification point EventQuery.SetNotificationPoint "CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT"
'check to see if filter has been set up correctly Dim bIsFiltering bIsFiltering = EventQuery.IsEventFilterFiltering()
'-----------------EXECUTION------------------
'start the filters EventQuery.StartEventFiltering
'wait for query completion Dim iCnt iCnt = 0 Dim bDone bDone = False While (Not bDone) bDone = EventQuery.IsQueryComplete() If( Not bDone) Then 'event hasn't completed yet iCnt = iCnt + 1 If( iCnt > 100 ) Then bDone = True 'tired of waiting, just terminate Else WScript.Sleep(1000) End if End if Wend
'-----------------RESULTS------------------
Dim strAudError, strElsAlmError, strElsError Dim nSize, recKey, pvEventInfoXml, pvKeyList, iRec
'Aud EventQuery.GetAudQueryError strAudError EventQuery.GetFilteredAudListSize nSize
pvKeyList = "" EventQuery.GetFilteredAudList pvKeyList For iRec = 0 To nSize - 1 recKey = pvKeyList (iRec) pvEventInfoXml = "" EventQuery.GetAudEventInfoAsXml recKey, pvEventInfoXml
MsgBox pvEventInfoXml Next
EventQuery.GetAudQueryError(strAudError)
'ElsAlm EventQuery.GetElsAlmQueryError strElsAlmError EventQuery.GetFilteredElsAlmListSize nSize
pvKeyList = "" EventQuery.GetFilteredElsAlmList pvKeyList For iRec = 0 To nSize - 1 recKey = pvKeyList (iRec) pvEventInfoXml = "" EventQuery.GetElsAlmEventInfoAsXml recKey, pvEventInfoXml
MsgBox pvEventInfoXml Next
EventQuery.GetElsAlmQueryError(strElsAlmError)
'Els EventQuery.GetElsQueryError strElsError EventQuery.GetFilteredElsListSize nSize
pvKeyList = "" EventQuery.GetFilteredElsList pvKeyList For iRec = 0 To nSize - 1 recKey = pvKeyList (iRec) pvEventInfoXml = "" EventQuery.GetElsEventInfoAsXml recKey, pvEventInfoXml
MsgBox pvEventInfoXml Next
EventQuery.GetElsQueryError(strElsError)
'event query is finished EventQuery.CancelEventFiltering() EventQuery.DestroyEventFilter(100)
End Sub |
The DestroyEventFilter method terminates execution of the filter thread, and waits for the specified number of seconds.
DestroyEventFilter(TimeToWaitInSeconds As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
TimeToWaitInSeconds |
Yes |
The number of seconds to wait for the event query to terminate. This value must be within the range [1 - 100]. |
This method will hang for the specified number of seconds while the filter thread terminates. If the filter thread has not terminated by the time the interval has expired, this method will return false and the filter thread will continue to attempt to terminate in the background. Call this method as part of the cleanup routine after querying is finished.
Example
The following example cleans up the query after it is finished, by canceling the filtering and destroying the filter.
|
Sub
'event query is finished EventQuery.CancelEventFiltering() EventQuery.DestroyEventFilter(100)
End Sub |
The FormatSiteServicePlusDbKey method puts a Site.Service and a DbKey into the 'Site.Service+DbKey'format.
FormatSiteServicePlusDbKey(SiteService As String, DbKey As String, SiteServiceDbKey As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The Site.Service to be formatted. |
|
DbKey |
Yes |
The DbKey to be formatted. |
|
SiteServiceDbKey |
Yes |
The return value in the 'Site.Service+DbKey'format. |
This method returns false if one of the SiteService or DbKey parameters is invalid. To retrieve the constituent Site.Service and DbKey from a 'Site.Service+DbKey'string, use the ParseSiteServicePlusDbKey method.
Example
The following example formats a Site.Service and DbKey and displays the result, then parses the result back into its constituent parts, and displays them. The two outputs should be identical.
|
Sub
Dim strSiteService strSiteService = "CYGDEMO.AUD"
Dim strDbKey strDbKey = "0000006547C0000001A0000001"
Dim strSiteServiceDbKey
Dim bRet bRet = EventQuery.FormatSiteServicePlusDbKey(strSiteService, strDbKey, strSiteServiceDbKey)
If (bRet) Then MsgBox strSiteServiceDbKey End If
bRet = EventQuery.ParseSiteServicePlusDbKey(strSiteServiceDbKey, strSiteService, strDbKey)
If (bRet) Then MsgBox strSiteService + "+" + strDbKey End If
End Sub |
The GetAudEventInfoAsXml method returns event information for the given AUD Site.Service and DbKey.
GetAudEventInfoAsXml(SiteServiceDbKey As String, EventInfoXml As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteServiceDbKey |
Yes |
The AUD Site.Service and DbKey in the 'Site.Service+DbKey'format. |
|
EventInfoXml |
Yes |
The event information for the AUD Site Service returned as a string. |
After querying is complete, this method is used in conjunction with GetFilteredAudList to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetAudFilterAsXml method returns the AUD event filter as an XML string.
GetAudFilterAsXml(XmlFilter As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string returned from this method. |
Example
The following example sets the AUD event filter, then retrieves it from the query and displays it.
|
Sub
'set the service-specific filter from an existing XML (see the documentation for 'SetAudFilterAsXml for an example of an XML filter) Dim bSetAud bSetAud = EventQuery.SetAudFilterAsXml(g_xmlAudFilter)
Dim xmlAudFilter
If (bSetAud) Then bGetAud = EventQuery.GetAudFilterAsXml(xmlAudFilter)
If (bGetAud) Then MsgBox xmlAudFilter End If End If
End Sub |
The GetAudQueryError method returns the last error (if any) in the AUD query.
GetAudQueryError(Error As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Error |
Yes |
The last error in the AUD query as a string. This value is an empty string if there is no error. |
This method returns true if there is an error in the AUD query, otherwise it returns false.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetAudQueryError method returns event information for the given ELSALM Site.Service and DbKey.
GetElsAlmEventInfoAsXml(SiteServiceDbKey As String, EventInfoXml As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteServiceDbKey |
Yes |
The ELSALM Site.Service and DbKey in the 'Site.Service+DbKey'format. |
|
EventInfoXml |
Yes |
The event information for the ELSALM Site Service returned as a string. |
After querying is complete, this method is used in conjunction with GetFilteredElsAlmList to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetElsAlmFilterAsXml method returns the ELSALM event filter as an XML string.
GetElsAlmFilterAsXml(XmlFilter As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string returned from this method. |
Example
The following example sets the ELSALM event filter, then retrieves it from the query and displays it.
|
Sub
'set the service-specific filter from an existing XML (see the documentation for 'SetElsAlmFilterAsXml for an example of an XML filter) Dim bSetElsAlm bSetElsAlm = EventQuery.SetElsAlmFilterAsXml(g_xmlElsAlmFilter)
Dim xmlElsAlmFilter
If (bSetElsAlm) Then bGetElsAlm = EventQuery.GetElsAlmFilterAsXml(xmlElsAlmFilter)
If (bGetElsAlm) Then MsgBox xmlElsAlmFilter End If End If
End Sub |
The GetElsAlmQueryError method returns the last error (if any) in the ELSALM query.
GetElsAlmQueryError(Error As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Error |
Yes |
The last error in the ELSALM query as a string. This value is an empty string if there is no error. |
This method returns true if there is an error in the ELSALM query, otherwise it returns false.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetElsEventInfoAsXml method returns event information for the given ELS Site.Service and DbKey.
GetElsEventInfoAsXml(SiteServiceDbKey As String, EventInfoXml As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteServiceDbKey |
Yes |
The ELS Site.Service and DbKey in the 'Site.Service+DbKey'format. |
|
EventInfoXml |
Yes |
The event information for the ELS Site Service returned as a string. |
After querying is complete, this method is used in conjunction with GetFilteredElsList to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetElsFilterAsXml method returns the ELS event filter as an XML string.
GetElsFilterAsXml(XmlFilter As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string returned from this method. |
Example
The following example sets the ELS event filter, then retrieves it from the query and displays it.
|
Sub
'set the service-specific filter from an existing XML (see the documentation for 'SetElsFilterAsXml for an example of an XML filter) Dim bSetEls bSetEls = EventQuery.SetElsFilterAsXml(g_xmlElsFilter)
Dim xmlElsFilter
If (bSetEls) Then bGetEls = EventQuery.GetElsFilterAsXml(xmlElsFilter)
If (bGetEls) Then MsgBox xmlElsFilter End If End If
End Sub |
The GetElsQueryError method returns the last error (if any) in the ELS query.
GetElsQueryError(Error As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Error |
Yes |
The last error in the ELS query as a string. This value is an empty string if there is no error. |
This method returns true if there is an error in the ELS query, otherwise it returns false.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetFilteredAudList method returns the list of filtered AUD events as Site.Service and DbKey pairs.
GetFilteredAudList(SiteSvcKeyList As Array) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteSvcKeyList |
Yes |
A list of Site.Service and DbKey pairs (in the 'Site.Service+DbKey'format) representing the filtered AUD events. |
After querying is complete, this method is used in conjunction with GetAudEventInfoAsXml to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetFilteredAudListSize method returns the size of the filtered AUD event list as an integer
GetFilteredAudListSize(Size As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Size |
Yes |
The size of the filtered AUD event list. |
The filtered AUD event list itself can be obtained via GetFilteredAudList.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetFilteredElsAlmList method returns the list of filtered ELSALM events as Site.Service and DbKey pairs.
GetFilteredElsAlmList(SiteSvcKeyList As Array) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteSvcKeyList |
Yes |
A list of Site.Service and DbKey pairs (in the 'Site.Service+DbKey'format) representing the filtered ELSALM events. |
After querying is complete, this method is used in conjunction with GetElsAlmEventInfoAsXml to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetFilteredElsAlmListSize method returns the size of the filtered ELSALM event list as an integer
GetFilteredElsAlmListSize(Size As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Size |
Yes |
The size of the filtered ELSALM event list. |
The filtered ELSALM event list itself can be obtained via GetFilteredElsAlmList.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetFilteredElsList method returns the list of filtered ELS events as Site.Service and DbKey pairs.
GetFilteredElsList(SiteSvcKeyList As Array) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteSvcKeyList |
Yes |
A list of Site.Service and DbKey pairs (in the 'Site.Service+DbKey'format) representing the filtered ELS events. |
After querying is complete, this method is used in conjunction with GetElsEventInfoAsXml to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The GetFilteredElsListSize method returns the size of the filtered ELS event list as an integer
GetFilteredElsListSize(Size As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Size |
Yes |
The size of the filtered ELS event list. |
The filtered ELS event list itself can be obtained via GetFilteredElsList.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The IsEventFilterFiltering method returns true if the entire query process has been set up and is enabled to run.
IsEventFilterFiltering() As Boolean
This method will return true after a successful call to StartEventFiltering. Once the filtering has begun, this method will only return false if the filtering has been canceled using CancelEventFiltering, or if the filter has been destroyed using DestroyEventFilter.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The IsEventFilterFiltering method returns true if the event query thread is running.
IsEventFilterRunning() As Boolean
The event query thread is executed after an event filter is created; therefore, after an event filter is created, this method will only return false if the filter has been destroyed using DestroyEventFilter.
Example
The following example creates an event filter, checks that it is running, destroys it, and checks that it is no longer running.
|
Sub
Dim bCreatedOk bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)
Dim bRunning bRunning = EventQuery.IsEventFilterRunning()
MsgBox bRunning 'should be "True"
EventQuery.DestroyEventFilter(100)
bRunning = EventQuery.IsEventFilterRunning()
MsgBox bRunning 'should be "False"
End Sub |
The IsQueryComplete method returns true if all of the queries are no longer being executed.
IsQueryComplete() As Boolean
This method will return true as long as any AUD, ELSALM, or ELS query is being executed. It will return false if all running queries fail when adding to the respective query cache, if the filter is destroyed using DestroyEventFilter, or if the previous query results are cleared using ClearQueryResults.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The ParseSiteServicePlusDbKey method returns the Site.Service and DbKey elements from a 'Site.Service+DbKey'string.
ParseSiteServicePlusDbKey(SiteServiceDbKey As String, SiteService As String, DbKey As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteServiceDbKey |
Yes |
The string to be parsed, in the 'Site.Service+DbKey'format. |
|
SiteService |
Yes |
The Site.Service parsed from SiteServiceDbKey. |
|
DbKey |
Yes |
The DbKey parsed from SiteServiceDbKey. |
This method returns false if one of the SiteService or DbKey parameters returned is invalid. This method does the reverse of the FormatSiteServicePlusDbKey method. To format a Site.Service and DbKey into a 'Site.Service+DbKey'string, use the FormatSiteServicePlusDbKey method.
Example
The following example formats a Site.Service and DbKey and displays the result, then parses the result back into its constituent parts, and displays them. The two outputs should be identical.
|
Sub
Dim strSiteService strSiteService = "CYGDEMO.AUD"
Dim strDbKey strDbKey = "0000006547C0000001A0000001"
Dim strSiteServiceDbKey
Dim bRet bRet = EventQuery.FormatSiteServicePlusDbKey(strSiteService, strDbKey, strSiteServiceDbKey)
If (bRet) Then MsgBox strSiteServiceDbKey End If
bRet = EventQuery.ParseSiteServicePlusDbKey(strSiteServiceDbKey, strSiteService, strDbKey)
If (bRet) Then MsgBox strSiteService + "+" + strDbKey End If
End Sub |
The SetAudFilterAsXml method sets the AUD event filter from an XML string.
SetAudFilterAsXml(XmlFilter As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string representing the AUD event filter to be set. |
This method returns false if the XML filter is invalid.
The following is an example of an XML AUD event filter.
|
<ExportedRules ruleDataIdentifier='AUD Rules'> <Rules enabled='true'inverted='false'op='1'name=''> <Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CXEVENTIF_OPID'operator='='qualifier='Case Insensitive'> <compareItem property='AuditOpId'type='0'/> </Rule> <Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='FAC'operator='='qualifier='Case Insensitive'> <compareItem property='AudItemCat'type='0'/> </Rule> <Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CXEVENTIF_FAC_E'operator='='qualifier='Case Insensitive'> <compareItem property='AudItemId'type='0'/> </Rule> </Rules> </ExportedRules> |
This filter will select all AUD events for which (Audit Operation ID = "CXEVENTIF_OPID" AND Audit Item Category = "FAC" AND Audit Item ID = "CXEVENTIF_FAC_E"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of AUD XML property names, see AUD XML Properties.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The SetAudMaxCacheSize method sets the maximum size of the AUD query cache.
SetAudMaxCacheSize(MaxSize As Long) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
MaxSize |
Yes |
A long integer specifying the maximum cache size. This value must be between 20,000 and 10,000,000. |
This method will return false if the specified cache size is out of the range [20,000 - 10,000,000]. If this method is not used, the default maximum cache size of 20,000 records will be used.
Example
The following example creates an event filter and sets the maximum AUD cache size to 50,000 before executing the query.
|
Sub
'create event filter Dim bCreatedOk bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)
'initialize the filter (this step is necessary) EventQuery.ClearQueryResults
EventQuery.SetAudMaxCacheSize 50000
'finish initializing and execute query
End Sub |
The SetAudPersistHours method sets the amount of time (in hours) that the AUD query cache will persist.
SetAudPersistHours(Hours As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Hours |
Yes |
The number of hours the AUD query cache will persist. This value must be between 0 and 100. |
This method will return false if the specified number of hours is out of the range [0 - 100]. If this method is not used, the default of 24 hours will be used.
Example
The following example creates an event filter and sets the AUD cache persist hours to 50 before executing the query.
|
Sub
'create event filter Dim bCreatedOk bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)
'initialize the filter (this step is necessary) EventQuery.ClearQueryResults
EventQuery.SetAudPersistHours 50
'finish initializing and execute query
End Sub |
The SetAudSiteServices method defines the list of AUD site services for the AUD event filter.
SetAudSiteServices(SiteServices As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteServices |
Yes |
A semicolon-delimited list of AUD Site.Services (for example, "CYGDEMO.AUD;CYGDEMO.AUD1") |
This method will only return false if a filter has not yet been created.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The SetElsAlmFilterAsXml method sets the ELSALM event filter from an XML string.
SetElsAlmFilterAsXml(XmlFilter As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string representing the ELSALM event filter to be set. |
This method returns false if the XML filter is invalid.
The following is an example of an XML ELSALM event filter.
|
<ExportedRules ruleDataIdentifier='ELSALM Event Rules'> <Rules enabled='true'inverted='false'op='1'name=''> <Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CxEventIf_ElsAlmTest'operator='='qualifier='Case Insensitive'> <compareItem property='Source'type='0'/> </Rule> <Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='SET'operator='='qualifier='Case Insensitive'> <compareItem property='Category'type='0'/> </Rule> </Rules> </ExportedRules> |
This filter will select all ELSALM events for which (ELS Source = "CXEVENTIF_OPID" AND ELS Category = "CONTROL"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of ELSALM XML property names, see ELSALM XML Properties.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The SetElsAlmMaxCacheSize method sets the maximum size of the ELSALM query cache.
SetElsAlmMaxCacheSize(MaxSize As Long) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
MaxSize |
Yes |
A long integer specifying the maximum cache size. This value must be between 20,000 and 10,000,000. |
This method will return false if the specified cache size is out of the range [20,000 - 10,000,000]. If this method is not used, the default maximum cache size of 20,000 records will be used.
Example
The following example creates an event filter and sets the maximum ELSALM cache size to 50,000 before executing the query.
|
Sub
'create event filter Dim bCreatedOk bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)
'initialize the filter (this step is necessary) EventQuery.ClearQueryResults
EventQuery.SetElsAlmMaxCacheSize 50000
'finish initializing and execute query
End Sub |
The SetElsAlmPersistHours method sets the amount of time (in hours) that the ELSALM query cache will persist.
SetElsAlmPersistHours(Hours As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Hours |
Yes |
The number of hours the ELSALM query cache will persist. This value must be between 0 and 100. |
This method will return false if the specified number of hours is out of the range [0 - 100]. If this method is not used, the default of 24 hours will be used.
Example
The following example creates an event filter and sets the ELSALM cache persist hours to 50 before executing the query.
|
Sub
'create event filter Dim bCreatedOk bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)
'initialize the filter (this step is necessary) EventQuery.ClearQueryResults
EventQuery.SetElsAlmPersistHours 50
'finish initializing and execute query
End Sub |
The SetElsAlmSiteServices method defines the list of ELSALM site services for the ELSALM event filter.
SetElsAlmSiteServices(SiteServices As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteServices |
Yes |
A semicolon-delimited list of Site.Services (for example, "CYGDEMO.ELSALM;CYGDEMO.ELSALM1") |
This method will only return false if a filter has not yet been created.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The SetElsFilterAsXml method sets the ELS event filter from an XML string.
SetElsFilterAsXml(XmlFilter As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string representing the ELS event filter to be set. |
This method returns false if the XML filter is invalid.
The following is an example of an XML ELS event filter.
|
<ExportedRules ruleDataIdentifier='ELS Event Rules'> <Rules enabled='true'inverted='false'op='1'name=''> <Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CxEventIf_ElsTest'operator='='qualifier='Case Insensitive'> <compareItem property='Source'type='0'/> </Rule> <Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CONTROL'operator='='qualifier='Case Insensitive'> <compareItem property='Category'type='0'/> </Rule> </Rules> </ExportedRules> |
This filter will select all ELS events for which (ELS Source = "CXEVENTIF_OPID" AND ELS Category = "CONTROL"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of ELS XML property names, see ELS XML Properties.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The SetElsMaxCacheSize method sets the maximum size of the ELS query cache.
SetElsMaxCacheSize(MaxSize As Long) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
MaxSize |
Yes |
A long integer specifying the maximum cache size. This value must be between 20,000 and 10,000,000. |
This method will return false if the specified cache size is out of the range [20,000 - 10,000,000]. If this method is not used, the default maximum cache size of 20,000 records will be used.
Example
The following example creates an event filter and sets the maximum ELS cache size to 50,000 before executing the query.
|
Sub
'create event filter Dim bCreatedOk bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)
'initialize the filter (this step is necessary) EventQuery.ClearQueryResults
EventQuery.SetElsMaxCacheSize 50000
'finish initializing and execute query
End Sub |
The SetElsPersistHours method sets the amount of time (in hours) that the ELS query cache will persist.
SetElsPersistHours(Hours As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Hours |
Yes |
The number of hours the ELS query cache will persist. This value must be between 0 and 100. |
This method will return false if the specified number of hours is out of the range [0 - 100]. If this method is not used, the default of 24 hours will be used.
Example
The following example creates an event filter and sets the ELS cache persist hours to 50 before executing the query.
|
Sub
'create event filter Dim bCreatedOk bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)
'initialize the filter (this step is necessary) EventQuery.ClearQueryResults
EventQuery.SetElsPersistHours 50
'finish initializing and execute query
End Sub |
The SetElsSiteServices method defines the list of ELS site services for the ELS event filter.
SetElsSiteServices(SiteServices As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SiteServices |
Yes |
A semicolon-delimited list of Site.Services (for example, "CYGDEMO.ELS;CYGDEMO.ELS1") |
This method will only return false if a filter has not yet been created.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The SetNotificationPoint method sets the CVS point which will contain a notification of when the queries have completed.
SetNotificationPoint(Tag As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The CVS tag of the point to be used for notifications (for example, "CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT"). |
This method will return false if the specified tag is invalid. Note that this method does not actually create a CVS point. A CVS point with the specified tag must exist prior to starting event filtering in order for CVS notifications to succeed.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
The StartEventFiltering method initiates event filtering on the background thread.
StartEventFiltering() As Boolean
This method returns false if no event filter has been created.
It is necessary to call ClearQueryResults after creating a filter in order to run to the filter.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.